package com.ruoyi.system.domain.dto;

import cn.hutool.core.collection.CollectionUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * @author nanyang
 */
public class TAbnormalDataDto {

    @Data
    @ApiModel("TAbnormalDataDto - Insert")
    public static class Insert {
        @NotNull(message = "姓名不能为空")
        @ApiModelProperty("姓名")
        private String name;
        @ApiModelProperty("性别")
        private Byte sex;
        @ApiModelProperty("住院号")
        private String hospitalizationNumber;
        @ApiModelProperty("档案号")
        private String fileNum;
        @ApiModelProperty("治疗类型(多选，值用逗号隔开)")
        private String treatmentType;
        @ApiModelProperty("病例状态")
        private Byte caseStatus;
        @ApiModelProperty("上报状态（0未上报  1已上报）")
        private Byte reportStatus;
        @ApiModelProperty("核实状态")
        private Byte checkStatus;
        @ApiModelProperty("出院时间")
        private Date leaveTime;
        @ApiModelProperty("手术操作标化名称")
        private String operationName;
        @ApiModelProperty("建档单位")
        private String createCompany;
        @ApiModelProperty("数据来源")
        private Byte source;

        @ApiModelProperty("子表数据")
        private List<AbnormalDataRecordDto> recordDtoList;
    }

    @Data
    @ApiModel("修改异常数据")
    public static class Update {
        @ApiModelProperty("ID")
        private Long id;
        @NotNull(message = "姓名不能为空")
        @ApiModelProperty("姓名")
        private String name;
        @ApiModelProperty("性别")
        private Byte sex;
        @ApiModelProperty("住院号")
        private String hospitalizationNumber;
        @ApiModelProperty("档案号")
        private String fileNum;
        @ApiModelProperty("治疗类型(多选，值用逗号隔开)")
        private String treatmentType;
        @ApiModelProperty("病例状态")
        private Byte caseStatus;
        @ApiModelProperty("上报状态（0未上报  1已上报）")
        private Byte reportStatus;
        @ApiModelProperty("核实状态")
        private Byte checkStatus;
        @ApiModelProperty("出院时间")
        private Date leaveTime;
        @ApiModelProperty("手术操作标化名称")
        private String operationName;
        @ApiModelProperty("建档单位")
        private String createCompany;
        @ApiModelProperty("数据来源")
        private Byte source;

        @ApiModelProperty("子表数据")
        private List<AbnormalDataRecordDto> recordDtoList;
    }

    @Data
    @ApiModel("删除异常数据")
    public static class Delete {
        @ApiModelProperty("删除ID")
        private List<Long> idList;
    }


    @Data
    @ApiModel("查询异常数据")
    public static class Query {
        @ApiModelProperty("档案ID")
        private Long id;
        @ApiModelProperty("姓名")
        private String name;
        @ApiModelProperty("住院号")
        private String hospitalizationNumber;
        @ApiModelProperty("档案号")
        private String fileNum;
        @ApiModelProperty("治疗类型(多选，值用逗号隔开)")
        private String treatmentType;
        @ApiModelProperty("病例状态")
        private Byte caseStatus;
        @ApiModelProperty("上报状态（0未上报  1已上报）")
        private Byte reportStatus;
        @ApiModelProperty("核实状态")
        private Byte checkStatus;
        @ApiModelProperty("出院时间开始")
        private Date leaveTimeStart;
        @ApiModelProperty("出院时间结束")
        private Date leaveTimeEnd;
        @ApiModelProperty("手术操作标化名称")
        private String operationName;

        @ApiModelProperty("code集合")
        private List<String> codeList;

        public List<String> getCodeList() {
            if (CollectionUtil.isNotEmpty(codeList)) {
                codeList.remove("");
                return codeList;
            }
            return codeList;
        }

    }


    @Data
    @ApiModel("异常数据子表")
    public static class AbnormalDataRecordDto {
        @ApiModelProperty("key")
        private String code;
        @ApiModelProperty("value")
        private String answer;
    }

}
